<%@page import="aex.domain.ArticleCategory"%>
<%@page import="aex.domain.Article"%>
<%@page import="aex.service.ShowViewService"%>
<%@page import="aex.util.SSHUtil"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page import="aex.domain.Puser"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
WebApplicationContext ac = SSHUtil.getApplication(request);
ShowViewService svService = (ShowViewService) ac.getBean(ShowViewService.SERVICE_NAME);
%>

<!DOCTYPE>
<html>
  <head>
    <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <meta name="keywords" content="${webKeyWord}">
	<meta name="description" content="${webDescription}" />
	<title> ${webTitle} </title>
	<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
  	
	<link rel="stylesheet" type="text/css" href="expandStyle/aex_userPage.css">
	<link rel="stylesheet" type="text/css" href="expandStyle/index.css" />
	<link rel="stylesheet" type="text/css" href="expandStyle/tab.css" />
	<link rel="stylesheet" type="text/css" href="expandStyle/comment.css" />
	<link rel="stylesheet" type="text/css" href="expandStyle/users.css" />
	<link href="systemStyle/H-ui.css" rel="stylesheet" type="text/css" />
	<link href="systemStyle/H-ui.admin.css" rel="stylesheet" type="text/css" />
	
	
	<script type="text/javascript" src="http://libs.useso.com/js/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="expandStyle/aex_userPage.js"></script>
	<script type="text/javascript" src="expandStyle/tab.js"></script>
	<script type="text/javascript" src="expandStyle/message.js"></script>
	<script type="text/javascript" src="systemJs/aex_admin.js"></script>
	<script type="text/javascript" src="plugin/layer/layer.min.js"></script>
	<script type="text/javascript" src="plugin/layer/extend/layer.ext.js"></script>
	<script type="text/javascript" src="systemJs/H-ui.admin.js"></script>
	<script type="text/javascript" src="systemJs/Validform_v5.3.2_min.js"></script>
	
	</head>
  <body>
    
    <!--导航栏-->
    
    <%
    	Puser user=(Puser)request.getSession().getAttribute("user");
    	if(user==null){
    		%>
    			<jsp:include page="/systemPage/headNavVisitor1.jsp"></jsp:include>		
    		<%
    	}else{
    		%>
				<jsp:include page="/systemPage/headNavVisitor2.jsp"></jsp:include>
    		<%
    	}
    %>
	
	
	
	
	 <!--主要内容-->
  <div class="container">
  	 <div class="container_left">
  	     <!--选项卡-->
        <div class="tab1" id="tab1">
           <div class="menu" id="menu_id">
                <ul>
                  <li id="one1" class="off" onclick="setTab('one',1)">文章</li>
                  <li id="one2" onclick="setTab('one',2)">关注</li>
                  <li id="one3" onclick="setTab('one',3)">小组</li>
                  <li id="one4" onclick="setTab('one',4)">留言</li>
                  <li id="one5" onclick="setTab('one',5)">我的资料</li>
                  <li id="one6" onclick="setTab('one',6)">修改密码</li>
                </ul>
           </div>
           <div class="menudiv">
           
           <!-- 我的文章 -->
                <div id="con_one_1" style="display:block;">
               	 <c:forEach var="item" items="${pageBean.objList }" >
                    <div class="post">
                       <a href="visitor/visitor_article.do?arId=${item.arId}"> ${item.arTitle }</a>
                       <div id="topics_comment"> 浏览 (${item.arViewCount })</div>
                    </div> 
                   </c:forEach>
                   	<jsp:include page="/systemPage/paginationVisitor.jsp"></jsp:include>
                   
                 </div>
                 
                 <!-- 我的关注 -->
                 <div id="con_one_2" style="display:none;">
                       <div id="active_usersBox">
                         <ul>
                          	 <c:forEach var="item" items="${user.attentionUsersForAuAttention }" >
	                           <li>
	                              <img src="${item.puserByAuAattentiond.puPhoto }" width="50px" height="50px" >
	                              <div><a href="visitor/visitor_herHome.do?id=${item.puserByAuAattentiond.puId }">${item.puserByAuAattentiond.puName }</a></div>
	                            </li>
                           </c:forEach>
                           
                         </ul>
                      </div>
                 </div>
                 
                 <!-- 我加入的小组 -->
                  <div id="con_one_3" style="display:none;">
                  
                   <c:forEach var="item" items="${user.categoryEditers }" >
                      <div class="group">
                         <div class="group_img"><img src="${item.articleCategory.acPhoto }" width="80px" height="80px"></div>
                         <div class="group_content">
                            <div class="group_name"><a href="visitor/visitor_showCategory.do?id=${item.articleCategory.acId }">${item.articleCategory.acName }</a><span>共${item.articleCategory.acUserNum }人</span></div>
                            <div class="smallContent">
                              ${item.articleCategory.acDescription }
                            </div>
                         </div>
                      </div>
                   </c:forEach> 
                 </div>
                 
                 
                 <!--留言板-->
                  <div id="con_one_4" style="display:none;">
                     <div class="comment_article">
                        <div class="comment_contentBox">
                         <c:forEach var="item" items="${user.messageBoardsForMbPued }" >
                          <div class="comment_line">
                            <div class="tourist">
                               <img src="${item.puserByMbPu.puPhoto}" width="50px" height="50px" >
                              <div><a href="users.html">${item.puserByMbPu.puName}</a></div>
                            </div>
                            <div class="comment_content">
                              <div class="c_contentTop">"
				                      ${item.mbContent}
                              </div>
                                <div class="c_contentDown">
                                <a href="user/user_deleteLy.do?id=${item.mbId }">删除</a>&nbsp;&nbsp;&nbsp;<span href="#" id="time">&nbsp;&nbsp; &nbsp;：${item.mbTime}</span>
                              </div>
                              
                            </div>
                          </div>
                          </c:forEach>
                      </div>
                     </div>
                
                 </div>
                
                 <!-- 我的资料 -->
                  <div id="con_one_5" style="display:none;">
                  
                     <form action="#" method="post" id='Huiform'>
                      <input name="puId" value="${user.puId }" type="hidden" > 
                        <div class="people_photo">
                           <div class="data_title">头像：</div>
                           <div class="uploadImg" style="margin-left: 5px;" >
		          				<img src="${user.puPhoto }" id='targerImg' width="100" height="100"  />
		          				<a class="btn btn-default"  onclick="layer_show(600,300,'上传照片','visitorPage/fileUpload.jsp')"  >上传头像</a>
		          			</div>
                        </div>
                        <div class="people_info">
                           <div class="data_title">昵称：</div>
                           <div class="data_text"><input type="text" name='puName' value="${user.puName}" ></div>
                        </div>
                          <div class="people_info">
                           <div class="data_title">性别：</div>
                           <div class="data_text1">
                           	<c:if test="${user.puSex eq '男' }">
                           		<label><input type="radio" checked="checked" name="puSex" value="1" >男</label>
                           		<label><input type="radio" name="puSex"  value="2" >女</label>
                           	</c:if>
                           	<c:if test="${user.puSex eq '女' }">
                           		<label><input type="radio" name="puSex" value="1" >男</label>
                           		<label><input type="radio" checked="checked" name="puSex"  value="2">女</label>
                           	</c:if>
                           	<c:if test="${user.puSex eq null }">
                           		<label><input type="radio" name="puSex"  value="1" >男</label>
                           		<label><input type="radio" name="puSex"  value="2">女</label>
                           	</c:if>
                           
                           	</div>
                        </div>
                        <div class="people_info">
                           <div class="data_title">邮箱：</div>
                           <div class="data_text"><input type="text" name="puEmail" value="${user.puEmail}"></div>
                        </div>
                         <div class="sub_box" id="sub_box1"><input type="button" onclick="submitHuman()" class="pass_sub" value=" 保存 "></div>
                     </form>
                 </div>
                 
                 
                 
                 
                 <div id="con_one_6" style="display:none;">
                   <form  method="post" class='demoform'>
                   <input name="puId" value="${user.puId }" type="hidden" > 
                      <div class="password"><div class="pass_title">新密码：</div><div class="pass_text"><input name='puPassword' datatype="*6-16" type="password"></div></div>
                      <div class="password"><div class="pass_title">确认新密码：</div><div class="pass_text"><input type="password"  datatype="*" recheck="puPassword" ></div></div>
                      <div class="sub_box"><input type="button" onclick="submintPass()" class="pass_sub pass_sub1" value="修改"></div>
                   </form>
                 </div>
                 	<script type="text/javascript">
						$(".demoform").Validform({
							tiptype : 3,
							});
						
						function submintPass(){
							$.ajax({
								cache : true,
								type : "POST",
								url : 'user/puser_updatePassword.do',
								data : $('.demoform').serialize(),
								async : false,
								error : function(request) {
									alert("请求出现错误！");
								},
								success : function(data) {
									layer.alert(data,9);
									location.replace(location.href);
							}});
						}
						
						
						
						function submitHuman(){
							var imgPath=$('#targerImg').attr('src');
							$.ajax({
								cache : true,
								type : "POST",
								url : 'user/puser_updateUser.do?imgPath='+imgPath,
								data : $('#Huiform').serialize(),
								async : false,
								error : function(request) {
									alert("请求出现错误！");
								},

								success : function(data) {
									layer.alert(data,9);
									location.replace(location.href);
							}});
						}
						</script>
                 
                 
           </div>
  	    </div>
     </div>
  	 <div class="container_right">
        <!--用户-->
        <div id="user_box">
             <img src="${user.puPhoto }" align="left" width="50" height="50" >
            <div class="user_info">
                <h2><a href="users.html">${user.puName}</a></h2>
            </div>
            <ul class="attention_box">
              <li><span>${user.puAttention}</span><div>关注</div></li>
              <li><span>${user.puFans}</span><div>粉丝</div></li>
              <li><span>${user.puScore}</span><div>积分</div></li>
            </ul>
        </div>
      <!--关注的用户-->
       <div id="user_attention">
          <h2>关注的用户</h2>
           <ul>
               <c:forEach var="item" items="${user.attentionUsersForAuAttention }" >
	                           <li>
	                              <img src="${item.puserByAuAattentiond.puPhoto }" width="50px" height="50px" >
	                              <div><a href="visitor/visitor_herHome.do?id=${item.puserByAuAattentiond.puId }">${item.puserByAuAattentiond.puName }</a></div>
	                            </li>
                           </c:forEach>
           </ul>
       </div>
      <!--加入的小组-->
       <div id="add_groups">
          <h2>加入的小组</h2>
           <ul>
           <c:forEach var="item" items="${user.categoryEditers }" >
           		<li>
                  <img src="${item.articleCategory.acPhoto }" width="50px" height="50px" >
                  <div><a href="visitor/visitor_showCategory.do?id=${item.articleCategory.acId }">${item.articleCategory.acName }</a></div>
                </li> 
             </c:forEach>         
           </ul>
       </div>


     </div>
  </div>
  
	
	

	
	
    <!--网站底部-->
	<jsp:include page="/systemPage/footerVisitor.jsp"></jsp:include>
  </body>
</html>
